index.html.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <template>
  2. <!-- 页面头部 -->
  3. <HomePageHead></HomePageHead>
  4. <!-- 导航栏 -->
  5. <HomePageNavigation1></HomePageNavigation1>
  6. <!-- 列表页广告一 -->
  7. <HomeTopTen :imgurl="adImg1" v-if="adImg1"></HomeTopTen>
  8. <!-- 面包屑导航 -->
  9. <div class="breadcrumb">
  10. <div class="inner">
  11. <span class="location">当前位置:</span>
  12. <el-breadcrumb :separator-icon="ArrowRight">
  13. <el-breadcrumb-item>
  14. <NuxtLink to="/">首页</NuxtLink>
  15. </el-breadcrumb-item>
  16. <el-breadcrumb-item>
  17. {{ newsDetail.con_title }}
  18. </el-breadcrumb-item>
  19. </el-breadcrumb>
  20. </div>
  21. </div>
  22. <!-- 资讯列表 -->
  23. <div class="newsDetail">
  24. <div class="inner">
  25. <div class="innerDetail">
  26. <div class="headImg"></div>
  27. <div class="innerDetail1">
  28. <div class="leftBottom" v-html="newsDetail.content"></div>
  29. </div>
  30. <div class="footImg"></div>
  31. </div>
  32. <div class="innerLeft">
  33. <ul>
  34. <li>
  35. 导航列表
  36. </li>
  37. <li v-for="(item, index) in bottomMenu" :key="index">
  38. <NuxtLink :to="`/about/${item.name_pinyin}/index.html`" :title="item.name"
  39. v-if="item.id == pageId && item.id != 7" class="active">
  40. {{ item.name }}
  41. </NuxtLink>
  42. <NuxtLink :to="`/about/${item.name_pinyin}/index.html`" :title="item.name"
  43. v-else-if="item.id != pageId && item.id != 7">
  44. {{ item.name }}
  45. </NuxtLink>
  46. <NuxtLink :to="`/about/${item.name_pinyin}/list-1.html`" :title="item.name"
  47. v-if="item.id == 7 && pageId == 7 && routeHref == '/specialList/7'" class="active">
  48. {{item.name }}
  49. </NuxtLink>
  50. <NuxtLink :to="`/about/${item.name_pinyin}/list-1.html`" :title="item.name" v-else-if="item.id == 7">
  51. {{ item.name}}
  52. </NuxtLink>
  53. </li>
  54. </ul>
  55. </div>
  56. <div style="clear: both;"></div>
  57. </div>
  58. </div>
  59. <!-- 广告二 -->
  60. <HomeTopTen :imgurl="adImg2" v-if="adImg2"></HomeTopTen>
  61. <!-- 页面底部 -->
  62. <HomeFoot1></HomeFoot1>
  63. </template>
  64. <script setup>
  65. //1.页面依赖 start ---------------------------------------->
  66. import { ElBreadcrumb, ElBreadcrumbItem } from 'element-plus'
  67. import { ArrowRight } from '@element-plus/icons-vue'
  68. import { ref, onMounted } from 'vue';
  69. //获得跳转过来的id
  70. const route = useRoute();
  71. //获得当前的完整路径
  72. const fullPath = route.path;
  73. //拆分,取出来中间这一段,然后提取数字部分
  74. const segments = fullPath.split('/');
  75. const targetSegment = segments[2];
  76. //const numberPart = targetSegment.match(/\d+$/)?.[0];
  77. let articleId;
  78. let pageId;
  79. //通过导航路径反向查询导航id
  80. const getRouteId = await requestDataPromise('/web/getWebsiteRoute', {
  81. method: 'GET',
  82. query: {
  83. 'foot_pinyin': targetSegment,
  84. },
  85. });
  86. if(getRouteId.code == 200){
  87. articleId = getRouteId.data.id;
  88. pageId = getRouteId.data.id;
  89. }else{
  90. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  91. console.log("错误位置:通过url路径查询导航池id")
  92. console.log("后端错误反馈:",getRouteId.message)
  93. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  94. }
  95. //1.页面依赖 end ---------------------------------------->
  96. //2.页面数据 start ---------------------------------------->
  97. //广告列表
  98. const adList = ref([]);
  99. let adImg1 = ref([]);
  100. let adImg2 = ref([]);
  101. async function getAdData(){
  102. const adData = await requestDataPromise('/web/getWebsiteAdvertisement',{method:'GET',query:{'ad_tag':'PAGE'}});
  103. adList.value = adData.data;
  104. if(adData.code==200){
  105. for(let item of adData.data){
  106. if(item.ad_tag == 'PAGE_0001'){
  107. adImg1.value = item;
  108. }
  109. if(item.ad_tag == 'PAGE_0002'){
  110. adImg2.value = item;
  111. }
  112. }
  113. }else{
  114. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  115. console.log("错误位置:获取详情页广告列表")
  116. console.log("后端错误反馈:",adData.message)
  117. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  118. }
  119. }
  120. getAdData();
  121. const newsDetail = ref({})
  122. const bottomMenu = ref([]);
  123. async function getPageData() {
  124. const mkdata = await requestDataPromise('/web/getWebsiteFooterCategoryInfo', {
  125. method: 'GET',
  126. query: {
  127. 'fcat_id': articleId,
  128. 'type': '0'
  129. },
  130. });
  131. newsDetail.value = mkdata.data;
  132. }
  133. getPageData();
  134. async function getPageMenu() {
  135. const mkdata = await requestDataPromise('/web/getWebsiteFooterCategory', {
  136. method: 'GET',
  137. query: {},
  138. });
  139. bottomMenu.value = mkdata.data;
  140. }
  141. getPageMenu();
  142. //2.页面数据 end ---------------------------------------->
  143. //4.设置seo信息 start---------------------------------------->
  144. //4.1 设置seo信息
  145. const setData = await requestDataPromise('/web/getWebsiteFootInfo', {
  146. method: 'GET',
  147. query: {},
  148. });
  149. let seoTitle = setData.data.website_head.title;
  150. let seoDescription = setData.data.website_head.description;
  151. let seoKeywords = setData.data.website_head.keywords;
  152. let seoSuffix = setData.data.website_head.suffix;
  153. let seoName = setData.data.website_head.website_name;
  154. useSeoMeta({
  155. title: seoTitle + "_" + seoSuffix,
  156. meta: [
  157. { name: 'description', content: seoDescription + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
  158. { name: 'keywords', content: seoKeywords + "_" + seoName + "_" + seoSuffix , tagPriority: 10 }
  159. ]
  160. });
  161. //4.设置seo信息 end---------------------------------------->
  162. onMounted(async () => {
  163. //从客户端获取行政职能部门 加快打开速度
  164. const { $webUrl, $CwebUrl } = useNuxtApp();
  165. //广告1
  166. let url = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=nmw_page_0001`
  167. const responseAd1 = await fetch(url, {
  168. headers: {
  169. 'Content-Type': 'application/json',
  170. 'Userurl': $CwebUrl,
  171. 'Origin': $CwebUrl
  172. }
  173. });
  174. const resultAd1 = await responseAd1.json();
  175. adImg1.value = resultAd1.data[0];
  176. //广告2
  177. let url2 = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=nmw_page_0002`
  178. const responseAd2 = await fetch(url2, {
  179. headers: {
  180. 'Content-Type': 'application/json',
  181. 'Userurl': $CwebUrl,
  182. 'Origin': $CwebUrl
  183. }
  184. });
  185. const resultAd2 = await responseAd2.json();
  186. adImg2.value = resultAd2.data[0];
  187. })
  188. </script>
  189. <style lang="less" scoped>
  190. @import '@/assets/css/about.less';
  191. </style>